<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	    		xmlns:ui="http://java.sun.com/jsf/facelets"
	  			xmlns:h="http://java.sun.com/jsf/html"
	  			xmlns:f="http://java.sun.com/jsf/core"
	  			xmlns:s="http://jboss.com/products/seam/taglib"
                xmlns:a="http://richfaces.org/a4j"
                xmlns:rich="http://richfaces.org/rich"
				template="template.xhtml">

<ui:define name="page-name">
	<h:outputText value="Carteiras"/>
</ui:define>

<!-- content -->
<ui:define name="content">

<div class="section">
	<h:form id="bookings">
		<s:button
			id="voltar"
			value="Voltar"
			view="/carteiras.xhtml"
			propagation="end"/>
	</h:form>
</div>

<div class="section">
<h:form id="criarCarteira">
	<rich:panel>
	  	<f:facet name="header">
	  		<h:outputText value="Dados da Carteira" />
	  	</f:facet>
	<h:panelGrid columns="2">
		<h:outputText value="nome" />
		<h:inputText value="#{carteiraHome.instance.nome}" />
	</h:panelGrid>
	</rich:panel>
	
	<rich:spacer height="7"/>
	
	<rich:panel>
	  	<f:facet name="header">
	  		<h:outputText value="Ativos participantes" />
	  	</f:facet>
	<rich:dataTable id="carteiras" value="#{carteiraHome.ativosCarteira}" var="ativ" styleClass="center" headerClass="center">
		<rich:column id="colNome">
			<f:facet name="header">Simbolo</f:facet>
			<h:outputText value="#{ativ.ativo.simbolo}" />
		</rich:column>
		<rich:column id="atualizacao">
			<f:facet name="header">Quantidade</f:facet>
			<rich:inputNumberSpinner value="#{ativ.quantidade}" style="height: 20px; width: 100px"/>
		</rich:column>
	</rich:dataTable>
	</rich:panel>
	<h:commandButton action="#{carteiraHome.update}" value="Atualizar" />
	<rich:spacer width="7"/>
	<h:commandButton action="#{carteiraHome.remove}" value="Remover" />
</h:form>
</div>

</ui:define>

</ui:composition>
